package drongo.desktop.utils
{
	import drongo.desktop.selector.Selector;
	import drongo.desktop.selector.SelectorEvent;
	
	import flash.events.EventDispatcher;
	
	public class Clipboard extends EventDispatcher
	{
		private var _datas:Array;
		public function Clipboard()
		{
			super();
			_datas=[];
		}
		public function copy(selector:Selector,dispatch:Boolean=true):void{
			_datas.length=0;
			for each (var i:Object in selector.selectedList) 
			{
				_datas.push(i);
			}
			if(dispatch){
				dispatchClipboardEvent();
			}
		}
		public function get datas():Array{
			return _datas;
		}
		private function dispatchClipboardEvent():void{
			this.dispatchEvent(new SelectorEvent(SelectorEvent.CLIPBOARD_CHANGE));
		}
		private static var _instance:Clipboard;
		public static function get single():Clipboard{
			_instance||=new Clipboard();
			return _instance;
		}
	}
}